home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / corelib / ncbimsg.h < prev    next >
Text File  |  1996-07-05  |  6KB  |  220 lines

  1. /*   ncbimsg.h
  2. * ===========================================================================
  3. *
  4. *                            PUBLIC DOMAIN NOTICE
  5. *               National Center for Biotechnology Information
  6. *
  7. *  This software/database is a "United States Government Work" under the
  8. *  terms of the United States Copyright Act.  It was written as part of
  9. *  the author's official duties as a United States Government employee and
  10. *  thus cannot be copyrighted.  This software/database is freely available
  11. *  to the public for use. The National Library of Medicine and the U.S.
  12. *  Government have not placed any restriction on its use or reproduction.
  13. *
  14. *  Although all reasonable efforts have been taken to ensure the accuracy
  15. *  and reliability of the software and data, the NLM and the U.S.
  16. *  Government do not and cannot warrant the performance or results that
  17. *  may be obtained by using this software or data. The NLM and the U.S.
  18. *  Government disclaim all warranties, express or implied, including
  19. *  warranties of performance, merchantability or fitness for any particular
  20. *  purpose.
  21. *
  22. *  Please cite the author in any work or product based on this material.
  23. *
  24. * ===========================================================================
  25. *
  26. * File Name:  ncbimsg.h
  27. *
  28. * Author:  Gish, Kans, Ostell, Schuler
  29. *
  30. * Version Creation Date:   1/1/91
  31. *
  32. * $Revision: 2.7 $
  33. *
  34. * File Description:
  35. *       prototypes for message and alert handling
  36. *
  37. * Modifications:
  38. * --------------------------------------------------------------------------
  39. * Date     Name        Description of modification
  40. * -------  ----------  -----------------------------------------------------
  41. * 04-15-93 Schuler     Changed _cdecl to LIBCALL
  42. * 05-28-93 Schuler     New function: SetMonitorHook()
  43. * 06-09-93 Schuler     Added magic_value field to Monitor
  44. * 01-13-94 Schuler     Added SetMsgHook and SetBeepHook
  45. *
  46. * ==========================================================================
  47. */
  48.  
  49. #ifndef _NCBIMSG_
  50. #define _NCBIMSG_
  51.  
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55.  
  56. #include <ncbierr.h>
  57.  
  58. /*************************************************************************\
  59. |                                ALERTS                                   |
  60. \*************************************************************************/
  61.  
  62.  
  63. typedef enum MsgKey
  64. {
  65.     KEY_NONE =0, 
  66.     KEY_OK,
  67.     KEY_OKC,
  68.     KEY_ARI,
  69.     KEY_YNC,
  70.     KEY_YN,
  71.     KEY_RC,
  72.     KEY_other
  73. }
  74. MsgKey;
  75.  
  76. #define MSG_OK   KEY_OK
  77. #define MSG_OKC  KEY_OKC
  78. #define MSG_ARI  KEY_ARI
  79. #define MSG_YNC  KEY_YNC
  80. #define MSG_YN   KEY_YN
  81. #define MSG_RC   KEY_RC
  82. #define MSG_ERROR   (KEY_other +1)
  83. #define MSG_FATAL   (KEY_other +2)
  84. #define MSG_POST    (KEY_other +3)
  85. #define MSG_POSTERR (KEY_other +4)
  86.  
  87.  
  88. /* Message response codes */
  89. typedef enum MsgAnswser
  90. {
  91.     ANS_NONE,
  92.     ANS_OK,
  93.     ANS_CANCEL,
  94.     ANS_ABORT,
  95.     ANS_RETRY,
  96.     ANS_IGNORE,
  97.     ANS_YES,
  98.     ANS_NO
  99. }
  100. MsgAnswer;
  101.  
  102. /******
  103. #define ANS_NO 0
  104. #define ANS_YES 1
  105. #define ANS_OK 1
  106. #define ANS_RETRY 1
  107. #define ANS_ABORT 2
  108. #define ANS_CANCEL 2
  109. #define ANS_IGNORE 3
  110. ******/
  111.  
  112.  
  113. MsgAnswer CDECL Nlm_Message VPROTO((Nlm_Int2 keysev, const char *fmt, ...));
  114.  
  115. MsgAnswer CDECL   Nlm_MsgAlert VPROTO((MsgKey key, ErrSev sev, 
  116.         const char *caption, const char *fmt, ...));
  117. MsgAnswer LIBCALL Nlm_MsgAlertStr PROTO((MsgKey key, ErrSev sev, 
  118.         const char *caption, const char *message));
  119.  
  120. typedef MsgAnswer (LIBCALLBACK *MessageHook) PROTO((MsgKey key, ErrSev sev, 
  121.         const char *caption, const char *message));
  122.             
  123. MessageHook LIBCALL Nlm_SetMessageHook PROTO((MessageHook hook));
  124.  
  125. #define Message Nlm_Message
  126. #define MsgAlert Nlm_MsgAlert
  127. #define MsgAlertStr Nlm_MsgAlertStr
  128. #define SetMessageHook Nlm_SetMessageHook
  129.  
  130. /*************************************************************************\
  131. |                                 BEEPS                                   |
  132. \*************************************************************************/
  133.  
  134. typedef void (LIBCALLBACK *BeepHook) PROTO((void));
  135.  
  136. void LIBCALL Nlm_Beep PROTO((void));
  137. BeepHook LIBCALL Nlm_SetBeepHook PROTO((BeepHook));
  138.  
  139. #ifndef DCLAP
  140. /* dang conflict w/ Windows Beep beep */
  141. #define Beep Nlm_Beep
  142. #endif
  143. #define SetBeepHook Nlm_SetBeepHook
  144.  
  145. /*************************************************************************\
  146. |                            PROGRESS MONITORS                            |
  147. \*************************************************************************/
  148. /* Monitor type codes */
  149. typedef enum _MonType_
  150. {
  151.     MonType_Int =1, MonType_Str
  152. }
  153. MonType;
  154.  
  155. /* Monitor notification codes */
  156. typedef enum _MonCode_
  157. {
  158.     MonCode_Create=1,
  159.     MonCode_Destroy,
  160.     MonCode_IntValue,
  161.     MonCode_StrValue
  162. }
  163. MonCode;
  164.  
  165. typedef struct _Monitor_
  166. {
  167.     MonType     type;
  168.     const char *strTitle;
  169.     long        intValue;
  170.     const char *strValue;
  171.     long        num1;
  172.     long        num2;
  173.     void       *extra;    /* hook function may put things here */
  174. }
  175. Nlm_Monitor, *Nlm_MonitorPtr;
  176.  
  177. #ifndef DCLAP
  178. #define Monitor Nlm_Monitor
  179. #define MonitorPtr Nlm_MonitorPtr
  180. #endif
  181.  
  182. typedef int (LIBCALLBACK *Nlm_MonitorHook) PROTO((Nlm_MonitorPtr pMon, MonCode code));
  183. #define MonitorHook Nlm_MonitorHook
  184.  
  185. Nlm_MonitorPtr LIBCALL Nlm_MonitorIntNew PROTO((Nlm_CharPtr title, Nlm_Int4 n1, Nlm_Int4 n2));
  186. Nlm_MonitorPtr LIBCALL Nlm_MonitorStrNew PROTO((Nlm_CharPtr title, Nlm_Int2 len));
  187. Nlm_Boolean LIBCALL Nlm_MonitorStrValue PROTO((Nlm_MonitorPtr mon, Nlm_CharPtr sval));
  188. Nlm_Boolean LIBCALL Nlm_MonitorIntValue PROTO((Nlm_MonitorPtr mon, Nlm_Int4 ival));
  189. Nlm_MonitorPtr LIBCALL Nlm_MonitorFree PROTO((Nlm_MonitorPtr mon));
  190. MonitorHook LIBCALL Nlm_SetMonitorHook PROTO((MonitorHook hook));
  191.  
  192. #define MonitorIntNew Nlm_MonitorIntNew
  193. #define MonitorStrNew Nlm_MonitorStrNew
  194. #define MonitorStrValue Nlm_MonitorStrValue
  195. #define MonitorIntValue Nlm_MonitorIntValue
  196. #define MonitorFree Nlm_MonitorFree
  197. #define SetMonitorHook Nlm_SetMonitorHook
  198.  
  199. /*****************************************************************************
  200. *
  201. *   Default Monitor
  202. *
  203. *****************************************************************************/
  204. typedef Nlm_Boolean (LIBCALLBACK * Nlm_ProgMonFunc) PROTO((Nlm_VoidPtr data, Nlm_CharPtr str));
  205.  
  206. Nlm_Boolean LIBCALL Nlm_ProgMon PROTO((Nlm_CharPtr str));
  207. Nlm_Boolean LIBCALL Nlm_SetProgMon PROTO((Nlm_ProgMonFunc func, Nlm_VoidPtr data));
  208. Nlm_Boolean LIBCALLBACK Nlm_StdProgMon PROTO((Nlm_VoidPtr data, Nlm_CharPtr str));
  209.  
  210. #define ProgMonFunc Nlm_ProgMonFunc
  211. #define ProgMon Nlm_ProgMon
  212. #define SetProgMon Nlm_SetProgMon
  213. #define StdProgMon Nlm_StdProgMon
  214.  
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218.  
  219. #endif
  220.